package com.example.hblog.module.controller;

import com.example.hblog.Result;
import com.example.hblog.module.pojo.User;
import com.example.hblog.module.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@CrossOrigin
@Slf4j
@RequestMapping("api/user")
public class TestController {

    @Autowired
    private UserService userService;
    @Autowired
    private HttpServletRequest request;

    @ResponseBody
    @GetMapping("/allUser")
    public List<User> allUsers() {
        return userService.allUser();
    }

    @ResponseBody
    @GetMapping("/test")
    public Result test() {
        return new Result(200,"yes",null);

    }


}
